package tasklist

import (
	"time"
)

type Task struct {
	Id         int
	Name       string
	Finish     int
	CreateTime string
	FinishTime string
}

func NewTask(name string) *Task {
	task := new(Task)
	task.Id = 0
	task.SetTaskName(name)
	task.Finish = 0
	task.CreateTime = time.Now().Format("2006-01-02 15:04:05")
	return task
}

func (this *Task) SetTaskName(name string) {
	this.Name = name
}

func (this *Task) SetTaskFinish() {
	this.Finish = 1
	this.FinishTime = time.Now().Format("2006-01-02 15:04:05")
}
